package client;

import rock.config.RpcServiceConfig;
import rock.proxy.RpcClientProxy;
import rock.remoting.transmit.RpcRequestTransmit;
import rock.remoting.transmit.socket.SocketRpcClient;
import service.IUserService;

import java.util.Random;

public class SocketClientMain {

    public static void main(String[] args) {
        RpcRequestTransmit rpcRequestTransmit = new SocketRpcClient();

        RpcServiceConfig rpcServiceConfig = new RpcServiceConfig();
        RpcClientProxy   rpcClientProxy   = new RpcClientProxy(rpcRequestTransmit, rpcServiceConfig);
        IUserService     userService      = rpcClientProxy.getProxy(IUserService.class);

        Random rand = new Random();
        for (int i = 0; i < 10; i++) {
            String user = userService.getUserById(rand.nextInt(10086));
            System.out.println(user);
        }
    }
}
